<?

if($Db->connect()){

  if($_SESSION["modify_mode"] == "Y"){


  }else{


  }

  echo  "<table border='1' class='dedeq'>\n".
        "<th> NO        </th>\n".
        "<th> LEVELMN   </th>\n".
        "<th> DESCP     </th>\n".
        "<th> STATUS    </th>\n".
        "<th> ENTRY     </th>\n".
        "<th> MODIFY    </th>\n".
        "<th> DELETE    </th>\n".
        "<th> VIEW      </th>\n".
        "<th> FINALIZE  </th>\n".
        "<th> APPROVED  </th>\n".
        "<th> JOURNAL   </th>\n".
        "<th> PROGRAMS  </th>\n".
        "<th> PICT      </th>\n";

  $CLFetchers->fetchLstAccess($Db,
                              $srcDbMstAccess,
                              $nAccess,
                              $lstAccess);

  for($iRow = 0; $iRow < $nAccess; $iRow++){

    $Misc->setValue($statusEntChk,0);
    $Misc->setValue($entryEntChk,0);
    $Misc->setValue($modifyEntChk,0);
    $Misc->setValue($deleteEntChk,0);
    $Misc->setValue($viewEntChk,0);
    $Misc->setValue($finalizeEntChk,0);
    $Misc->setValue($approvedEntChk,0);
    $Misc->setValue($journalEntChk,0);
    $Misc->setValue($programsEntChk,0);
    $Misc->setValue($pictEntChk,0);

    /**
    * Check if levelmnEnt and descEnt
    * is not empty
    * YES: copy lstAccess
    * NO : Do nothing
    *
    */
    if($_POST["levelMnEnt"][$iRow] == ''){

      $_POST["levelMnEnt"][$iRow] = $lstAccess["LEVELMN"][$iRow];
      $_POST["descpEnt"][$iRow]   = $lstAccess["DESCRIPTION"][$iRow];
    }else{

      /* do nothing */
    }

    if($_POST["statusEnt"][$iRow] == 1){

      $statusEntChk = _IS_CHECKED;
    }

    if($_POST["entryEnt"][$iRow] == 1){

      $entryEntChk = _IS_CHECKED;
    }

    if($_POST["modifyEnt"][$iRow] == 1){

      $modifyEntChk = _IS_CHECKED;
    }

    if($_POST["deleteEnt"][$iRow] == 1){

      $deleteEntChk = _IS_CHECKED;
    }

    if($_POST["viewEnt"][$iRow] == 1){

      $viewEntChk = _IS_CHECKED;
    }

    if($_POST["finalizeEnt"][$iRow] == 1){

      $finalizeEntChk = _IS_CHECKED;
    }

    if($_POST["approvedEnt"][$iRow] == 1){

      $approvedEntChk = _IS_CHECKED;
    }

    if($_POST["journalEnt"][$iRow] == 1){

      $journalEntChk = _IS_CHECKED;
    }

    if($_POST["programsEnt"][$iRow] == 1){

      $programsEntChk = _IS_CHECKED;
    }

    if($_POST["pictEnt"][$iRow] == 1){

      $pictEntChk = _IS_CHECKED;
    }

    $Misc->setValue($_POST["statusEnt"][$iRow],1);
    $Misc->setValue($_POST["entryEnt"][$iRow],1);
    $Misc->setValue($_POST["modifyEnt"][$iRow],1);
    $Misc->setValue($_POST["deleteEnt"][$iRow],1);
    $Misc->setValue($_POST["viewEnt"][$iRow],1);
    $Misc->setValue($_POST["finalizeEnt"][$iRow],1);
    $Misc->setValue($_POST["approvedEnt"][$iRow],1);
    $Misc->setValue($_POST["journalEnt"][$iRow],1);
    $Misc->setValue($_POST["programsEnt"][$iRow],1);
    $Misc->setValue($_POST["pictEnt"][$iRow],1);

    echo  "<tr>\n".

            "<td> ".($iRow + 1)." </td>\n".

            "<td> ".$GHtml->formInput("levelMnEnt[".$iRow."]",
                                      $_POST["levelMnEnt"][$iRow],
                                      $Misc->stdProperties().
                                      _MODE_READONLY)." </td>\n".

            "<td> ".$GHtml->formInput("descpEnt[".$iRow."]",
                                      $_POST["descpEnt"][$iRow],
                                      $Misc->stdProperties().
                                      _MODE_READONLY)." </td>\n".

            "<td> ".$GHtml->formCheckBox("statusEnt[".$iRow."]",
                                         $_POST["statusEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $statusEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("entryEnt[".$iRow."]",
                                         $_POST["entryEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $entryEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("modifyEnt[".$iRow."]",
                                         $_POST["modifyEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $modifyEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("deleteEnt[".$iRow."]",
                                         $_POST["deleteEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $deleteEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("viewEnt[".$iRow."]",
                                         $_POST["viewEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $viewEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("finalizeEnt[".$iRow."]",
                                         $_POST["finalizeEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $finalizeEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("approvedEnt[".$iRow."]",
                                         $_POST["approvedEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $approvedEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("journalEnt[".$iRow."]",
                                         $_POST["journalEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $journalEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("programsEnt[".$iRow."]",
                                         $_POST["programsEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $programsEntChk)." </td>\n".

            "<td> ".$GHtml->formCheckBox("pictEnt[".$iRow."]",
                                         $_POST["pictEnt"][$iRow],
                                         $Misc->stdProperties().
                                         $pictEntChk)." </td>\n".

          "</tr>\n";
  }

  echo  "</table><br/>\n";

  echo  $GHtml->formInputButton( "Save",
                                 "entry",
                                 "Entry-data",
                                 $stlButton).
      	"</form>\n ".
      	"</body>\n";

  $Db->dc();
}else{

  $Misc->usrDie("Oracle Connection Failed");
}

?>